<template>
  <wf-approve-history :processInstanceId="processInstanceId" :wfStatusOptions="wfStatusOptions" />
</template>

<script>
export default {
  name: 'FlowAudit',
  inject: ['getDataFromOthers'],
  props: {
    modelValue: {
      type: String,
      default: ''
    },
    bindInstanceId: {
      type: String,
      default: ''
    }
  },
  data() {
    return {
      wfStatusOptions: [],
      processInstanceId: ''
    };
  },
  computed: {},
  watch: {},
  created() {},
  mounted() {
    this.getDicts('wf_approve_status').then((response) => {
      this.wfStatusOptions = response.data;
    });
    this.getProcessInstanceId();
  },
  methods: {
    getProcessInstanceId() {
      if (this.getDataFromOthers && typeof this.getDataFromOthers == 'function' && this.getDataFromOthers()) {
        if (this.bindInstanceId) {
          this.processInstanceId = this.getDataFromOthers()[`${this.bindInstanceId}`] ?? '';
        } else {
          this.processInstanceId = this.getDataFromOthers().processInstanceId ?? '';
        }
      }
    }
  }
};
</script>
